<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Edit Article</title>
    </h:head>
    <h:body>
        <h:form id="editArticleForm" prependId="false">
            <h:outputLabel for="editArticleId" value="Id:"/>
            <h:outputText value="#{ownArticlesBean.selectedArticle.id}" id="editArticleId"/>
            <p:selectOneRadio id="editStatus" value="#{ownArticlesBean.selectedArticle.status}" required="true">
                <f:selectItem id="editSelection1"   itemLabel="Draft" itemValue="Draft" />
                <f:selectItem id="editSelection2"  itemLabel="Published" itemValue="Published" />
            </p:selectOneRadio>
            <hr></hr>
            <p:message for="editStatus"/>
            <h:outputLabel for="editTitle" value="Article Title(*):"/>
            <p:inputText value="#{ownArticlesBean.selectedArticle.title}" id="editTitle" required="true"/>
            <p:message for="editTitle"/>
            <hr></hr>
            <h:outputLabel for="editArticleBody" value="Body(*):"/>
            <p:inputTextarea rows="10" cols="40" value="#{ownArticlesBean.selectedArticle.articleBody}" id="editArticleBody" required="true"   />                        
            <p:message for="editArticleBody"/>
            <hr>  </hr>
            <h:outputLabel for="editDate" value="Publication Date:"/>
            <p:inputText value="#{ownArticlesBean.selectedArticle.date}" id="editDate" readonly="true">
                <f:convertDateTime pattern="dd/MM/yyyy"/>
            </p:inputText>
            <p:message for="editDate"/>
            <br></br>
            <p:commandButton value="Save Article" action="#{ownArticlesBean.persistSelectedArticle()}" update="editArticleForm" ></p:commandButton>
        </h:form>
    </h:body>      
</html>

